Skip to content

feat: add maxInlineSize option for size-based asset inlining#1378

Open
bartekkrok wants to merge 1 commit intocallstack:mainfrom
bartekkrok:feat/size-limit-for-inline-assets
Open

feat: add maxInlineSize option for size-based asset inlining#1378
bartekkrok wants to merge 1 commit intocallstack:mainfrom
bartekkrok:feat/size-limit-for-inline-assets

Conversation

@bartekkrok
Copy link
Copy Markdown

Summary

Currently, the assets loader only supports two modes for asset delivery: always
extract as separate files or always inline as base64 URIs. There is no way to
automatically inline small assets (where the base64 overhead is negligible) while
still extracting large ones — developers had to choose one strategy for all assets
or manually split rules by path.

This PR adds a maxInlineSize option (in bytes) to both assets-loader and
getAssetTransformRules. Assets whose largest scale variant is within the threshold
are inlined as base64 URIs; larger assets are extracted as separate files. The
comparison uses the largest scale variant (e.g. @3x) intentionally — when an asset
is inlined, all variants are embedded in the bundle, so the largest one determines
the worst-case size impact.

Test plan

  1. Add an asset smaller than the threshold and one larger than the threshold to a
    React Native screen.
  2. Configure the assets loader with maxInlineSize: .
  3. Build the app — verify the small asset is inlined as a base64 URI and the large
    asset is extracted as a separate file.
  4. Alternatively, use the tester app (apps/tester-app) which already has assets set
    up for manual validation.
  5. Verify the option works both when passed directly to assets-loader and via
    getAssetTransformRules({ maxInlineSize: ... }).

Assets whose largest scale variant is within the threshold are inlined as base64 URIs; larger assets are extracted as separate files. The option is supported in both the assets-loader directly and via getAssetTransformRules.
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 7, 2026

@bartekkrok is attempting to deploy a commit to the Callstack Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 7, 2026

⚠️ No Changeset found

Latest commit: 13d99a6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant